Fix messed up refcounting. (#348090, Chris Wilson)
authorMatthias Clasen <mclasen@redhat.com>
Thu, 20 Jul 2006 18:42:17 +0000 (18:42 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Thu, 20 Jul 2006 18:42:17 +0000 (18:42 +0000)
2006-07-20  Matthias Clasen  <mclasen@redhat.com>

* gtk/gtktextlayout.c (gtk_text_layout_set_contexts): Fix
messed up refcounting.  (#348090, Chris Wilson)

ChangeLog
ChangeLog.pre-2-10
gtk/gtktextlayout.c

index 83cd8a1303cd6a1b8450d8a24905f22f0f9e5f02..3327f4e2d4e9a227923332f13eb08d50a7f7d32d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2006-07-20  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtktextlayout.c (gtk_text_layout_set_contexts): Fix
+       messed up refcounting.  (#348090, Chris Wilson)
+
        * gtk/gtkicontheme.h: 
        * gtk/gtkicontheme.c (_gtk_icon_theme_ensure_builtin_cache): 
        Export this privately.
index 83cd8a1303cd6a1b8450d8a24905f22f0f9e5f02..3327f4e2d4e9a227923332f13eb08d50a7f7d32d 100644 (file)
@@ -1,5 +1,8 @@
 2006-07-20  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtktextlayout.c (gtk_text_layout_set_contexts): Fix
+       messed up refcounting.  (#348090, Chris Wilson)
+
        * gtk/gtkicontheme.h: 
        * gtk/gtkicontheme.c (_gtk_icon_theme_ensure_builtin_cache): 
        Export this privately.
index 42c3b83ee0ac7242bfd7b33db4abdae3b38803f7..5f62e70304b58003604ae9395173506891db0507 100644 (file)
@@ -369,17 +369,23 @@ gtk_text_layout_set_contexts (GtkTextLayout *layout,
 {
   g_return_if_fail (GTK_IS_TEXT_LAYOUT (layout));
 
-  if (layout->ltr_context)
-    g_object_unref (ltr_context);
+  if (layout->ltr_context != ltr_context)
+    {
+      if (layout->ltr_context)
+       g_object_unref (layout->ltr_context);
 
-  layout->ltr_context = ltr_context;
-  g_object_ref (ltr_context);
+      layout->ltr_context = ltr_context;
+      g_object_ref (layout->ltr_context);
+    }
 
-  if (layout->rtl_context)
-    g_object_unref (rtl_context);
+  if (layout->rtl_context != rtl_context)
+    {
+      if (layout->rtl_context)
+       g_object_unref (layout->rtl_context);
 
-  layout->rtl_context = rtl_context;
-  g_object_ref (rtl_context);
+      layout->rtl_context = rtl_context;
+      g_object_ref (layout->rtl_context);
+    }
 
   DV (g_print ("invalidating all due to new pango contexts (%s)\n", G_STRLOC));
   gtk_text_layout_invalidate_all (layout);